<?php
$username = array(
	'name'	=> 'username',
	'id'	=> 'username',
	'value' => (set_value('username'))?set_value('username'):((isset($user->username)?$user->username:''))
);
$username_label = '匿稱';

if(isset($user->email)){
	if(strpos($user->email,$this->config->item('temp_email','coplay'))){
		$user->email = '';
	}
}
$email = array(
	'name'	=> 'email',
	'id'	=> 'email',
	'value' => (set_value('email'))?set_value('email'):((isset($user->email)?$user->email:''))
);
$email_label = 'Email';

$user_birthdate = array(
	'name'	=> 'user_birthdate',
	'id'	=> 'user_birthdate',
	'value' => (set_value('user_birthdate'))?set_value('user_birthdate'):((isset($user->user_birthdate)?$user->user_birthdate:''))
);
$user_birthdate_label = '生日';

$user_sex = array(
	'name'	=> 'user_sex',
	'id'	=> 'user_sex',
	'value' => (set_value('user_sex'))?set_value('user_sex'):((isset($user->user_sex)?$user->user_sex:''))
);

$user_sex_options = array(
	'male'=>'男',
	'female'=>'女',
);
$user_sex_label = '性別';

$user_phone = array(
	'name'	=> 'user_phone',
	'id'	=> 'user_phone',
	'value' => (set_value('user_phone'))?set_value('user_phone'):((isset($user->user_phone)?$user->user_phone:''))
);
$user_phone_label = '電話';

$user_address = array(
	'name'	=> 'user_address',
	'id'	=> 'user_address',
	'value' => (set_value('user_address'))?set_value('user_address'):((isset($user->user_address)?$user->user_address:''))
);
$user_address_label = '住址';

$country = array(
	'name'	=> 'country',
	'id'	=> 'country',
	'value' => (set_value('country'))?set_value('country'):((isset($user->country)?$user->country:''))
);
$country_label = '國家';

$city = array(
	'name'	=> 'city',
	'id'	=> 'city',
	'value' => (set_value('city'))?set_value('city'):((isset($user->city)?$user->city:''))
);
$city_label = '城市';
?>
<div>
	<?php
	$attribute = array('id'=>'updateprofile_form'); 
	echo form_open('#',$attribute); ?>
	<div>
		<div id="">
			<div><div class="user_profile_label"><span><?php echo form_label($username_label,$username['id']); ?>：</span></div><div class="user_profile_element"><?php echo form_input($username); ?><span style="color:red;"><?php echo form_error($username['name']); ?></span></div></div>
			<div><div class="user_profile_label"><span><?php echo form_label($email_label,$email['id']); ?>：</span></div><div class="user_profile_element"><?php echo form_input($email); ?><span style="color:red;"><?php echo form_error($email['name']); ?><?php echo isset($errors[$email['name']])?$errors[$email['name']]:''; ?></span></div></div>
			<div><div class="user_profile_label"><span><?php echo form_label($user_birthdate_label,$user_birthdate['id']); ?>：</span></div><div class="user_profile_element"><?php echo form_input($user_birthdate); ?><span style="color:red;"><?php echo form_error($user_birthdate['name']); ?></span></div></div>
			<div>
				<div class="user_profile_label"><span><?php echo form_label($user_sex_label,'user_sex'); ?>：</span></div>
				<div class="user_profile_element"><?php echo form_dropdown('user_sex',$user_sex_options,(set_value('user_sex'))?set_value('user_sex'):((isset($user->user_sex)?$user->user_sex:'male'))); ?><span style="color:red;"><?php echo form_error($user_sex['name']); ?></span></div>
			</div>
			<div><div class="user_profile_label"><span><?php echo form_label($user_phone_label,$user_phone['id']); ?>：</span></div><div class="user_profile_element"><?php echo form_input($user_phone); ?><span style="color:red;"><?php echo form_error($user_phone['name']); ?></span></div></div>
			<div><div class="user_profile_label"><span><?php echo form_label($country_label,$country['id']); ?>：</span></div><div class="user_profile_element"><?php echo form_input($country); ?><span style="color:red;"><?php echo form_error($country['name']); ?></span></div></div>
			<div><div class="user_profile_label"><span><?php echo form_label($city_label,$city['id']); ?>：</span></div><div class="user_profile_element"><?php echo form_input($city); ?><span style="color:red;"><?php echo form_error($city['name']); ?></span></div></div>
			<div><div class="user_profile_label"><span><?php echo form_label($user_address_label,$user_address['id']); ?>：</span></div><div class="user_profile_element"><?php echo form_input($user_address); ?><span style="color:red;"><?php echo form_error($user_address['name']); ?></span></div></div>
		</div>
		<span><input type="button" value="修改" name="Send" onclick="SendUpdateProfileData();"/></span><span id="update_loading"></span>
	</div>
<?php echo form_close(); ?>
</div>